//
//  UIImageExtension.swift
//  edu
//
//  Created by karlzhou on 15/12/10.
//  Copyright © 2015年 karlzhou. All rights reserved.
//

import Foundation
extension UIImage{
   
    public static func resizableImage(name:String) -> UIImage{
        return self.resizableImage(name, leftRatio: 0.5, topRatio: 0.5)
    }
    
    public static func resizableImage(name:String,leftRatio:CGFloat,topRatio:CGFloat) -> UIImage{
        let image = UIImage(named: name);
        let left = (image?.size.width)! * leftRatio
        let top = (image?.size.height)! * topRatio
        return (image?.stretchableImageWithLeftCapWidth(Int(left), topCapHeight: Int(top)))!
    }
    
  
}